package javabase.schoolwork.day6_1to3;

import java.util.Date;

/**
 * @author fance
 * @date 2018/5/24 19:41
 */
public class Account {
    protected String name;
    protected String password;
    protected double balance;

    protected Date despositTime;
    protected Date withdawTime;
    protected double interestRate;
    public boolean deposit(double money) {
        this.balance += money;
        return true;
    }
    public boolean withdaw(double money) {
        if (money > this.balance) {
            return false;
        } else {
            this.balance -= money;
            return true;
        }
    }

    public Account() {
    }

    public Account(double money) {
        this.balance = money;
    }

    public Account(String name, String password, double money) {
        this.name = name;
        this.password = password;
        this.balance = money;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    @Override
    public String toString() {
        return "Account{" +
                "name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", balance=" + balance +
                ", despositTime=" + despositTime +
                ", withdawTime=" + withdawTime +
                ", interestRate=" + interestRate +
                '}';
    }
}
